package com.pattern.observer.case01;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
@Slf4j
public class LogService implements ApplicationListener<PurchaseEvent> {

    /**
     * 保存日志
     * @param event the event to respond to
     */
    @Override
    public void onApplicationEvent(PurchaseEvent event) {
        log.info("-----日志记录-----");
    }
}
